package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.util.ArrayList;
import java.util.List;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.bean.StkResBean;

public class DailyAdapter extends StkProviderMultiAdapter<StkResBean> {

    public DailyAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new DailyProvider());
    }

    private class DailyProvider extends BaseItemProvider<StkResBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_daily;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, StkResBean bean) {
            if (baseViewHolder.getBindingAdapterPosition() == 0) {
                baseViewHolder.setBackgroundColor(R.id.llDailyItem, Color.parseColor("#FDE6E4"));
                baseViewHolder.setImageResource(R.id.ivDailyItemIcon, R.drawable.amryj);
                baseViewHolder.setText(R.id.tvDailyItemTitle, getContext().getString(R.string.daily_sentence));
            } else if (baseViewHolder.getBindingAdapterPosition() == 1) {
                baseViewHolder.setBackgroundColor(R.id.llDailyItem, Color.parseColor("#E6D7FC"));
                baseViewHolder.setImageResource(R.id.ivDailyItemIcon, R.drawable.asgyl);
                baseViewHolder.setText(R.id.tvDailyItemTitle, getContext().getString(R.string.flash_quote));
            } else if (baseViewHolder.getBindingAdapterPosition() == 2) {
                baseViewHolder.setBackgroundColor(R.id.llDailyItem, Color.parseColor("#DEFFED"));
                baseViewHolder.setImageResource(R.id.ivDailyItemIcon, R.drawable.apyqwa);
                baseViewHolder.setText(R.id.tvDailyItemTitle, getContext().getString(R.string.friend_text));
            }
            baseViewHolder.setText(R.id.tvDailyItemContent, bean.getDesc());
        }
    }

}
